package com.prs.crm.domain.stock;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.OrderBy;
import javax.persistence.Table;

import com.prs.crm.domain.Address;
import com.prs.crm.domain.District;
import com.prs.crm.domain.FlowCodeEntity;
import com.prs.crm.domain.hr.Person;
import com.prs.crm.domain.sys.Code;

/**
 * 供应商
 * 
 * @author prs.chenzhi
 * 
 */
@Entity
@Table(name = "stock_supplier")
public class Supplier extends FlowCodeEntity {

	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;
	private String name;
	
	private  String  supplierCode;
	@ManyToOne
	private SupplierType type;
	private Address address;
	private String tel;
	private String fax;
	private String email;
	private String phone;
	@ManyToOne(fetch=FetchType.LAZY,cascade={CascadeType.MERGE,CascadeType.PERSIST},targetEntity=Person.class)
	@JoinColumn(name="person_id")
	@OrderBy
	private Person clerk;
	@ManyToOne
	private District district;
	private String deliveryAddress;
	private String contactPerson;
	
	private String remark;
	
//	
//	@OneToOne(fetch=FetchType.LAZY,mappedBy="supplier")
//	private Code code;
	
	public static long getSerialVersionUID() {
		return serialVersionUID;
	}

	public void setId(Integer id) {
		this.id = id;
	}

//	public Code getCode() {
//		return code;
//	}
//
//	public void setCode(Code code) {
//		this.code = code;
//	}

	public Integer getId() {
		return id;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getName() {
		return name;
	}

	

	public String getSupplierCode() {
		return supplierCode;
	}
	public void setSupplierCode(String supplierCode) {
		this.supplierCode = supplierCode;
	}
	public void setType(SupplierType type) {
		this.type = type;
	}

	public SupplierType getType() {
		return type;
	}

	public void setAddress(Address address) {
		this.address = address;
	}

	public Address getAddress() {
		return address;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getTel() {
		return tel;
	}

	public void setFax(String fax) {
		this.fax = fax;
	}

	public String getFax() {
		return fax;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getEmail() {
		return email;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getRemark() {
		return remark;
	}

	public void setContactPerson(String contactPerson) {
		this.contactPerson = contactPerson;
	}

	public String getContactPerson() {
		return contactPerson;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public Person getClerk() {
		return clerk;
	}

	public void setClerk(Person clerk) {
		this.clerk = clerk;
	}

	public District getDistrict() {
		return district;
	}

	public void setDistrict(District district) {
		this.district = district;
	}

	public String getDeliveryAddress() {
		return deliveryAddress;
	}

	public void setDeliveryAddress(String deliveryAddress) {
		this.deliveryAddress = deliveryAddress;
	}
	
}
